import sys
sys.dont_write_bytecode=True # don't make .pyc files
from lib   import *
from stats import *
from about import *

def rdivDemo(data):
  data = map(lambda lst:Num(lst[0],lst[1:],keep=512),
             data)
  for x in sorted(scottknott(data),key=lambda y:y.rank):
    print x.rank, x.name, gs([x.mu, x.s])

@demo
def rdiv0():
  rdivDemo([
        ["x1",0.34, 0.49, 0.51, 0.6],
        ["x2",6,  7,  8,  9]
        ])

@demo
def rdiv1():
  rdivDemo([
        ["x1",0.1,  0.2,  0.3,  0.4],
        ["x2",0.1,  0.2,  0.3,  0.4],
        ["x3",6,  7,  8,  9]
        ])

@demo
def rdiv2():
  rdivDemo([
        ["x1",0.34, 0.49, 0.51, 0.6],
        ["x2",0.6,  0.7,  0.8,  0.9],
        ["x3",0.15, 0.25, 0.4,  0.35],
        ["x4",0.6,  0.7,  0.8,  0.9],
        ["x5",0.1,  0.2,  0.3,  0.4]
        ])

@demo
def rdiv3():
  rdivDemo([
      ["x1",101, 100, 99,   101,  99.5],
      ["x2",101, 100, 99,   101, 100],
      ["x3",101, 100, 99.5, 101,  99],
      ["x4",101, 100, 99,   101, 100]
      ])

@demo
def rdiv4():
  rdivDemo([
      ["1",11,12,13],
      ["2",14,31,22],
      ["3",23,24,31],
      ["5",32,33,34]])

@demo
def rdiv5():
  rdivDemo([
      ["1",11,11,11],
      ["2",11,11,11],
      ["3",11,11,11]])

@demo
def rdiv6():
  rdivDemo([
      ["1",11,11,11],
      ["2",11,11,11],
      ["4",32,33,34,35]])

if __name__ == '__main__' : 
  eval(cmd('symd()'))
